package com.slofzx.nuoda.sso.enums;

import com.slofzx.nuoda.common.enums.SysPermission;

/**
 * 单点登录系统权限枚举
 * @author sunfuyong
 */
public enum PermissionEnum implements SysPermission {
    SSO_APP_VIEW("sso:app:view", "单点登录应用查询", "单点登录应用查询权限"),
    SSO_APP_CREATE("sso:app:create", "单点登录应用创建", "单点登录应用创建权限"),
    SSO_APP_EDIT("sso:app:edit", "单点登录应用编辑", "单点登录应用编辑权限"),
    SSO_APP_DELETE("sso:app:delete", "单点登录应用删除", "单点登录应用删除权限"),

    ;

    private String desc;
    private String id;
    private String name;

    @Override
    public String getDescription() {
        return this.desc;
    }

    @Override
    public String getId() {
        return this.id;
    }

    @Override
    public String getName() {
        return this.name;
    }

    PermissionEnum(String id, String name, String desc) {
        this.id = id;
        this.name = name;
        this.desc = desc;
    }

    public static PermissionEnum getEnum(String id) {
        for(PermissionEnum value: PermissionEnum.values()) {
            if (value.getId().equals(id)) {
                return value;
            }
        }

        return null;
    }
}
